package com.megvii.koala.components;

import android.content.Context;
import android.util.AttributeSet;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;
import android.widget.RelativeLayout;

import com.megvii.koala.R;

/**
 * Created by linyue on 16/1/7.
 */
public class ScanAnimView extends RelativeLayout
{

    public ScanAnimView(Context context)
    {
        super(context);
        init(context);
    }

    public ScanAnimView(Context context, AttributeSet attrs)
    {
        super(context, attrs);
        init(context);
    }

    public ScanAnimView(Context context, AttributeSet attrs, int defStyle)
    {
        super(context, attrs, defStyle);
        init(context);
    }

    public void init(Context context)
    {
        inflate(context, R.layout.scananim_layout, this);
        Animation anim = AnimationUtils.loadAnimation(this.getContext(), R.anim.scananim_rotate);
        LinearInterpolator lir = new LinearInterpolator();
        anim.setInterpolator(lir);
        findViewById(R.id.scananim_circle).startAnimation(anim);
    }
}
